
    <?php if (YII_DEBUG) :?>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Gwjr3HwxiUrvnG95u3xbWmiKz1ersGgx"></script>
    <?php else :?> 
        <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=Gwjr3HwxiUrvnG95u3xbWmiKz1ersGgx"></script>
    <?php endif; ?>
<div id="map" style="width:1200px;height:800px;">
</div>
        <form role="form" action="#" method="post" id="insight">
            <div class="box-body">
                <div class="form-group">
                    <label>经度</label>
                    <input type="text" class="form-control" name="Longitude" readonly id="jindu" value="<?php if (!empty($data['Longitude'])){ echo $data['Longitude'];} else {echo '103.97844';} ?>" />
                </div>
                <div class="form-group">
                    <label>纬度</label>
                    <input type="text" class="form-control" name="Latitude" readonly id="weidu" value="<?php if (!empty($data['Latitude'])){ echo $data['Latitude'];} else { echo "30.738014";} ?>" />
                </div>
            </div>
            <div class="box-footer">
                <button class="btn btn-primary" type="submit">更新</button>
            </div>
        </form>
<script type="text/javascript">
$(function(){
    var jingdu=$("#jindu").val();
    var weidu=$("#weidu").val();
    var map = new BMap.Map("map");  // 创建Map实例
    var point = new BMap.Point(jingdu,weidu);
    map.centerAndZoom(point,15);      // 初始化地图,用初始坐标设置地图中心点
    var marker = new BMap.Marker(point);//红色定位器初始位置
    map.addOverlay(marker);//添加标注图标
    map.enableScrollWheelZoom();//启用滚轮放大缩小
    map.enableKeyboard();//启用键盘上下左右键移动地图
    marker.enableDragging();//可拖拽地图
    
    marker.addEventListener("dragend",function(e){//地理位置图标拖动获取经纬度值
        $("#jindu").val(e.point.lng);
        $("#weidu").val(e.point.lat);
    });
})
</script>